<template>
  <div>
    <div class="expalin-class">
      <b>任务名称：</b>
        {{taskINFO.name}}
    </div>
    <div>
      <b>任务要求：</b>
      <h5 v-html="taskINFO.requirement"></h5>>
    </div>
    <div>
      <b>任务步骤</b>
      <div>
        <div>
        <b> 仿真实验步骤：</b>
          <h5 v-html="taskINFO.simStep"></h5>
        </div>
        <div><b>  实训实验步骤：</b>
          <h5 v-html="taskINFO.realStep"></h5>
        </div>
      </div>
      <div>
      </div>
    </div>
  </div>
</template>
<script>
  import {getCurrentTaskM, getTask, updateStep} from '@/api/api'
  export default {
    data () {
      return {
//        devices: '',
//        requirement: '',
//        simStep: '',
//        realStep: '',
        taskINFO: this.$store.state.taskINFO,
        currentTask: this.$store.state.currentTask
      }
    },
    created () {
      this.initData()
    },
    methods: {
      async initData () {
        try {
          getCurrentTaskM().then((res) => {
            this.$store.dispatch('currentTask', res.data)
            getTask(res.data.id).then((res) => {
              this.$store.dispatch('taskINFO', res.data)
            })
            this.loading = false
          })
        } catch (err) {
          console.log('获取数据失败', err)
        }
//        try {
//          getTask().then((res) => {
//            this.devices = res.data.name  // type 看下转换下，通过store获取
//            this.simStep = res.data.SDescription
//            this.realStep = res.data.PDescription
//            this.requirement = res.data.requirement
//          })
//        } catch (err) {
//          console.log('获取数据失败', err)
//        }
        updateStep({step: 1}).then(res => {
        })
      },
      goNext () {
        this.$router.push({path: '/platform/learn/textbook'})
      }
    }
  }
</script>
<style lang="less" scoped>
  .contain-head {
    border-top: 2px solid #499aff;
    background: #f3fbff;
    height: 60px;
    .el-button {
      float:right;
      margin-top: 10px;
    }
  }
  div {
    div {
      margin: 10px;
    }
  }
</style>
